| Visual Basic (Declaration) | |
|---|---|
<ExtensionAttribute()> Public Overloads Shared Function GroupBy (Of TSource,TKey)( _ ByVal source As IEntityQuery(Of TSource), _ ByVal keySelector As Expression(Of Func(Of TSource,TKey)) _ ) As IEntityQuery(Of IGrouping(Of TKey,TSource))  | |
| Visual Basic (Usage) |  Copy Code | 
|---|---|
Dim source As IEntityQuery(Of TSource) Dim keySelector As Expression(Of Func(Of TSource,TKey)) Dim value As IEntityQuery(Of IGrouping(Of TKey,TSource)) value = EntityQueryExtensions.GroupBy(Of TSource, TKey)(source, keySelector)  | |
| C# | |
|---|---|
[ExtensionAttribute()] public static IEntityQuery<IGrouping<TKey,TSource>> GroupBy<TSource,TKey>( IEntityQuery<TSource> source, Expression<Func<TSource,TKey>> keySelector )  | |
| C++/CLI | |
|---|---|
[ExtensionAttribute()] public: static IEntityQuery<IGrouping<TKey^,TSource^>^>^ GroupBygeneric<typename TSource> generic<typename TKey> ( IEntityQuery<TSource^>^ source, Expression<Func<TSource^,TKey^>^>^ keySelector )  | |
Parameters
- source
 - keySelector
 
Type Parameters
- TSource
 - TKey
 
| C# |  Copy Code | 
|---|---|
var mgr = new DomainModelEntityManager(); var query = mgr.Customers.GroupBy(c => c.Country); foreach (var group in query) { Console.WriteLine("key = " + group.Key); foreach (var cust in group) { Console.WriteLine("Cust = " + cust.CompanyName); } }  | |
Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family